﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Main.master" AutoEventWireup="true" CodeBehind="DaiDoi.aspx.cs" Inherits="WTSQCB.DaiDoi" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <p>
        &nbsp; Quản lý đại đội</p>
    <p>
        &nbsp;
        Thuộc tiểu đoàn:&nbsp;
        <asp:DropDownList ID="ViDuDropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2" DataTextField="TenTieuDoan" DataValueField="MaTieuDoan" Width="150px" OnSelectedIndexChanged="ViDuDropDownList1_SelectedIndexChanged">
        </asp:DropDownList>
    </p>
    <p>
        <asp:GridView ID="DaiDoiGridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="MaDaiDoi" DataSourceID="SqlDataSource1" OnSelectedIndexChanged="DaiDoiGridView1_SelectedIndexChanged" Width="980px" BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4">
            <Columns>
                <asp:CommandField ShowSelectButton="True" ButtonType="Button" SelectText="CHỌN" />
                <asp:BoundField DataField="MaDaiDoi" HeaderText="Mã đại đội" ReadOnly="True" SortExpression="MaDaiDoi" />
                <asp:BoundField DataField="TenDaiDoi" HeaderText="Tên đại đội" SortExpression="TenDaiDoi" />
                <asp:BoundField DataField="TenTieuDoan" HeaderText="Tên tiểu đoàn" SortExpression="TenTieuDoan" />
            </Columns>
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
            <RowStyle BackColor="White" ForeColor="#003399" />
            <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <SortedAscendingCellStyle BackColor="#EDF6F6" />
            <SortedAscendingHeaderStyle BackColor="#0D4AC4" />
            <SortedDescendingCellStyle BackColor="#D6DFDF" />
            <SortedDescendingHeaderStyle BackColor="#002876" />
        </asp:GridView>
    </p>
    <p>
        &nbsp;
        <asp:Button ID="ThemButton1" runat="server" OnClick="ThemButton1_Click" Text="THÊM" Width="80px" />
        &nbsp;
        <asp:Button ID="SuaButton2" runat="server" OnClick="SuaButton2_Click" Text="SỬA" Width="80px" />
        &nbsp;
        <asp:Button ID="XoaButton3" runat="server" OnClick="XoaButton3_Click" Text="XÓA" OnClientClick="return confirm('Bạn có muốn XÓA không ?')" Width="80px"/>
    </p>
    <p>
        &nbsp;
        Thông tin chi tiết:</p>
    <p>
        &nbsp;
        <asp:Label ID="Label1" runat="server" Text="Mã đại đội:"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:TextBox ID="MaDaiDoiTextBox1" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="MaDaiDoiTextBox1" ErrorMessage="RequiredFieldValidator" ForeColor="Red">Mã đại đội không được để trống</asp:RequiredFieldValidator>
    </p>
    <p>
        &nbsp;
        Tên đại đội:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;
        <asp:TextBox ID="TenDaiDoiTextBox2" runat="server"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TenDaiDoiTextBox2" ErrorMessage="RequiredFieldValidator" ForeColor="#FF3300">Tên đại đội không được để trống</asp:RequiredFieldValidator>
    </p>
    <p>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:WebDiemTSQCBConnectionString %>" SelectCommand="SELECT * FROM [TieuDoan]"></asp:SqlDataSource>
    </p>
    <p>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WebDiemTSQCBConnectionString %>" DeleteCommand="DaiDoiXoa" DeleteCommandType="StoredProcedure" InsertCommand="DaiDoiThem" InsertCommandType="StoredProcedure" SelectCommand="DaiDoiLocTieuDoan" SelectCommandType="StoredProcedure" UpdateCommand="DaiDoiSua" UpdateCommandType="StoredProcedure">
            <DeleteParameters>
                <asp:Parameter Name="madaidoi" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="madaidoi" Type="String" />
                <asp:Parameter Name="tendaidoi" Type="String" />
                <asp:Parameter Name="matieudoan" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="ViDuDropDownList1" Name="matieudoan" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter Name="madaidoi" Type="String" />
                <asp:Parameter Name="tendaidoi" Type="String" />
                <asp:Parameter Name="matieudoan" Type="String" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </p>
</asp:Content>
